clear all

cd "~\Data\
use "study3_raw.dta"


*attention check
rename populism_full_7 check_grid
recode check_grid 5=1 *=0
tab check_grid

sum check_*
alpha check_*, item gen(checksum)

keep if checksum==1
set obs 1000

*recoding conspiracy
recode conspiracy_1 conspiracy_2 conspiracy_3 conspiracy_4 (1=5) (2=4) (4=2) (5=1)

*recoding chaos
recode chaos1_1 chaos1_2 chaos1_3 chaos2_1 chaos2_2 chaos2_3 chaos2_4 (1=5) (2=4) (4=2) (5=1)

*recoding violence
recode violence_1 violence_2 violence_3 violence_4 (1=5) (2=4) (4=2) (5=1)

*recoding populism
recode populism_full_1 populism_full_2 populism_full_3 (1=5) (2=4) (4=2) (5=1)

*recoding HS
recode hs_full_1 hs_full_2 hs_full_3 (1=5) (2=4) (4=2) (5=1)

*recoding RR
recode raceresent_1 raceresent_2 (1=5) (2=4) (4=2) (5=1)

*creating scale halves
alpha conspiracy_1 conspiracy_2 conspiracy_3 conspiracy_4, item casewise gen(consp_for)
alpha conspiracy_5 conspiracy_6 conspiracy_7 conspiracy_8 conspiracy_9, item casewise gen(consp_rev_with6) /* including item 6*/
alpha conspiracy_5 conspiracy_7 conspiracy_8 conspiracy_9, item casewise gen(consp_rev) /* dropped item 6*/

alpha chaos1_1 chaos1_2 chaos1_3 chaos2_1 chaos2_2 chaos2_3 chaos2_4, item casewise gen(chaos_for)
alpha chaos1_4 chaos1_5 chaos1_6 chaos1_7 chaos2_5 chaos2_6 chaos2_7 chaos2_8, item casewise gen(chaos_rev_with6) /* including item 6 */
alpha chaos1_4 chaos1_5 chaos1_6 chaos1_7 chaos2_5  chaos2_7 chaos2_8, item casewise gen(chaos_rev) /* dropped item 6 */
cor chaos_for chaos_rev chaos_rev_with6

alpha violence_1 violence_2 violence_3 violence_4, item casewise gen(violence_for)
alpha violence_5 violence_6 violence_7 violence_8, item casewise gen(violence_rev)
cor violence_for violence_rev

alpha populism_full_1 populism_full_2 populism_full_3, item casewise gen(pop_for)
alpha populism_full_4 populism_full_5 populism_full_6, item casewise gen(pop_rev)
cor pop_for pop_rev

alpha hs_full_1 hs_full_2 hs_full_3, item casewise gen(hs_for)
alpha hs_full_4 hs_full_5 hs_full_6, item casewise gen(hs_rev)

alpha raceresent_1 raceresent_2, item casewise gen(rr_for)
alpha raceresent_3 raceresent_4, item casewise gen(rr_rev)



*************
* bootstrap *
*************

gen Cf_Hf=.
gen Cf_Hr=.
gen Cr_Hf=.
gen Cr_Hr=.

gen Cf_Vf=.
gen Cf_Vr=.
gen Cr_Vf=.
gen Cr_Vr=.

gen Cf_Pf=.
gen Cf_Pr=.
gen Cr_Pf=.
gen Cr_Pr=.

gen Cf_Sf=.
gen Cf_Sr=.
gen Cr_Sf=.
gen Cr_Sr=.

gen Cf_Rf=.
gen Cf_Rr=.
gen Cr_Rf=.
gen Cr_Rr=.

gen Hf_Vf=.
gen Hf_Vr=.
gen Hr_Vf=.
gen Hr_Vr=.

gen Hf_Pf=.
gen Hf_Pr=.
gen Hr_Pf=.
gen Hr_Pr=.

gen Hf_Sf=.
gen Hf_Sr=.
gen Hr_Sf=.
gen Hr_Sr=.

gen Hf_Rf=.
gen Hf_Rr=.
gen Hr_Rf=.
gen Hr_Rr=.

gen Vf_Pf=.
gen Vf_Pr=.
gen Vr_Pf=.
gen Vr_Pr=.

gen Vf_Sf=.
gen Vf_Sr=.
gen Vr_Sf=.
gen Vr_Sr=.

gen Vf_Rf=.
gen Vf_Rr=.
gen Vr_Rf=.
gen Vr_Rr=.

gen Pf_Sf=.
gen Pf_Sr=.
gen Pr_Sf=.
gen Pr_Sr=.

gen Pf_Rf=.
gen Pf_Rr=.
gen Pr_Rf=.
gen Pr_Rr=.

gen Sf_Rf=.
gen Sf_Rr=.
gen Sr_Rf=.
gen Sr_Rr=.


set seed 77007
forval x=1/1000 {
preserve
bsample

qui cor consp_for chaos_for
local CfHf=r(rho) in `x'
qui cor consp_for chaos_rev
local CfHr=r(rho) in `x'
qui cor consp_rev chaos_for
local CrHf=r(rho) in `x'
qui cor consp_rev chaos_rev
local CrHr=r(rho) in `x'

qui cor consp_for violence_for
local CfVf=r(rho) in `x'
qui cor consp_for violence_rev
local CfVr=r(rho) in `x'
qui cor consp_rev violence_for
local CrVf=r(rho) in `x'
qui cor consp_rev violence_rev
local CrVr=r(rho) in `x'

qui cor consp_for pop_for
local CfPf=r(rho) in `x'
qui cor consp_for pop_rev
local CfPr=r(rho) in `x'
qui cor consp_rev pop_for
local CrPf=r(rho) in `x'
qui cor consp_rev pop_rev
local CrPr=r(rho) in `x'

qui cor consp_for hs_for
local CfSf=r(rho) in `x'
qui cor consp_for hs_rev
local CfSr=r(rho) in `x'
qui cor consp_rev hs_for
local CrSf=r(rho) in `x'
qui cor consp_rev hs_rev
local CrSr=r(rho) in `x'

qui cor consp_for rr_for
local CfRf=r(rho) in `x'
qui cor consp_for rr_rev
local CfRr=r(rho) in `x'
qui cor consp_rev rr_for
local CrRf=r(rho) in `x'
qui cor consp_rev rr_rev
local CrRr=r(rho) in `x'


qui cor chaos_for violence_for
local HfVf=r(rho) in `x'
qui cor chaos_for violence_rev
local HfVr=r(rho) in `x'
qui cor chaos_rev violence_for
local HrVf=r(rho) in `x'
qui cor chaos_rev violence_rev
local HrVr=r(rho) in `x'

qui cor chaos_for pop_for
local HfPf=r(rho) in `x'
qui cor chaos_for pop_rev
local HfPr=r(rho) in `x'
qui cor chaos_rev pop_for
local HrPf=r(rho) in `x'
qui cor chaos_rev pop_rev
local HrPr=r(rho) in `x'

qui cor chaos_for hs_for
local HfSf=r(rho) in `x'
qui cor chaos_for hs_rev
local HfSr=r(rho) in `x'
qui cor chaos_rev hs_for
local HrSf=r(rho) in `x'
qui cor chaos_rev hs_rev
local HrSr=r(rho) in `x'

qui cor chaos_for rr_for
local HfRf=r(rho) in `x'
qui cor chaos_for rr_rev
local HfRr=r(rho) in `x'
qui cor chaos_rev rr_for
local HrRf=r(rho) in `x'
qui cor chaos_rev rr_rev
local HrRr=r(rho) in `x'


qui cor violence_for pop_for
local VfPf=r(rho) in `x'
qui cor violence_for pop_rev
local VfPr=r(rho) in `x'
qui cor violence_rev pop_for
local VrPf=r(rho) in `x'
qui cor violence_rev pop_rev
local VrPr=r(rho) in `x'

qui cor violence_for hs_for
local VfSf=r(rho) in `x'
qui cor violence_for hs_rev
local VfSr=r(rho) in `x'
qui cor violence_rev hs_for
local VrSf=r(rho) in `x'
qui cor violence_rev hs_rev
local VrSr=r(rho) in `x'

qui cor violence_for rr_for
local VfRf=r(rho) in `x'
qui cor violence_for rr_rev
local VfRr=r(rho) in `x'
qui cor violence_rev rr_for
local VrRf=r(rho) in `x'
qui cor violence_rev rr_rev
local VrRr=r(rho) in `x'


qui cor pop_for hs_for
local PfSf=r(rho) in `x'
qui cor pop_for hs_rev
local PfSr=r(rho) in `x'
qui cor pop_rev hs_for
local PrSf=r(rho) in `x'
qui cor pop_rev hs_rev
local PrSr=r(rho) in `x'

qui cor pop_for rr_for
local PfRf=r(rho) in `x'
qui cor pop_for rr_rev
local PfRr=r(rho) in `x'
qui cor pop_rev rr_for
local PrRf=r(rho) in `x'
qui cor pop_rev rr_rev
local PrRr=r(rho) in `x'


qui cor hs_for rr_for
local SfRf=r(rho) in `x'
qui cor hs_for rr_rev
local SfRr=r(rho) in `x'
qui cor hs_rev rr_for
local SrRf=r(rho) in `x'
qui cor hs_rev rr_rev
local SrRr=r(rho) in `x'

restore


qui replace Cf_Hf=`CfHf' in `x'
qui replace Cf_Hr=`CfHr' in `x'
qui replace Cr_Hf=`CrHf' in `x'
qui replace Cr_Hr=`CrHr' in `x'

qui replace Cf_Vf=`CfVf' in `x'
qui replace Cf_Vr=`CfVr' in `x'
qui replace Cr_Vf=`CrVf' in `x'
qui replace Cr_Vr=`CrVr' in `x'

qui replace Cf_Pf=`CfPf' in `x'
qui replace Cf_Pr=`CfPr' in `x'
qui replace Cr_Pf=`CrPf' in `x'
qui replace Cr_Pr=`CrPr' in `x'

qui replace Cf_Sf=`CfSf' in `x'
qui replace Cf_Sr=`CfSr' in `x'
qui replace Cr_Sf=`CrSf' in `x'
qui replace Cr_Sr=`CrSr' in `x'

qui replace Cf_Rf=`CfRf' in `x'
qui replace Cf_Rr=`CfRr' in `x'
qui replace Cr_Rf=`CrRf' in `x'
qui replace Cr_Rr=`CrRr' in `x'


qui replace Hf_Vf=`HfVf' in `x'
qui replace Hf_Vr=`HfVr' in `x'
qui replace Hr_Vf=`HrVf' in `x'
qui replace Hr_Vr=`HrVr' in `x'

qui replace Hf_Pf=`HfPf' in `x'
qui replace Hf_Pr=`HfPr' in `x'
qui replace Hr_Pf=`HrPf' in `x'
qui replace Hr_Pr=`HrPr' in `x'

qui replace Hf_Sf=`HfSf' in `x'
qui replace Hf_Sr=`HfSr' in `x'
qui replace Hr_Sf=`HrSf' in `x'
qui replace Hr_Sr=`HrSr' in `x'

qui replace Hf_Rf=`HfRf' in `x'
qui replace Hf_Rr=`HfRr' in `x'
qui replace Hr_Rf=`HrRf' in `x'
qui replace Hr_Rr=`HrRr' in `x'


qui replace Vf_Pf=`VfPf' in `x'
qui replace Vf_Pr=`VfPr' in `x'
qui replace Vr_Pf=`VrPf' in `x'
qui replace Vr_Pr=`VrPr' in `x'

qui replace Vf_Sf=`VfSf' in `x'
qui replace Vf_Sr=`VfSr' in `x'
qui replace Vr_Sf=`VrSf' in `x'
qui replace Vr_Sr=`VrSr' in `x'

qui replace Vf_Rf=`VfRf' in `x'
qui replace Vf_Rr=`VfRr' in `x'
qui replace Vr_Rf=`VrRf' in `x'
qui replace Vr_Rr=`VrRr' in `x'


qui replace Pf_Sf=`PfSf' in `x'
qui replace Pf_Sr=`PfSr' in `x'
qui replace Pr_Sf=`PrSf' in `x'
qui replace Pr_Sr=`PrSr' in `x'

qui replace Pf_Rf=`PfRf' in `x'
qui replace Pf_Rr=`PfRr' in `x'
qui replace Pr_Rf=`PrRf' in `x'
qui replace Pr_Rr=`PrRr' in `x'


qui replace Sf_Rf=`SfRf' in `x'
qui replace Sf_Rr=`SfRr' in `x'
qui replace Sr_Rf=`SrRf' in `x'
qui replace Sr_Rr=`SrRr' in `x'


di `x'
}


*difference in corrs
gen CH_fffr_diff=Cf_Hf-Cf_Hr
gen CH_ffrf_diff=Cf_Hf-Cr_Hf
gen CH_rrfr_diff=Cr_Hr-Cf_Hr
gen CH_rrrf_diff=Cr_Hr-Cr_Hf

gen CV_fffr_diff=Cf_Vf-Cf_Vr
gen CV_ffrf_diff=Cf_Vf-Cr_Vf
gen CV_rrfr_diff=Cr_Vr-Cf_Vr
gen CV_rrrf_diff=Cr_Vr-Cr_Vf

gen CP_fffr_diff=Cf_Pf-Cf_Pr
gen CP_ffrf_diff=Cf_Pf-Cr_Pf
gen CP_rrfr_diff=Cr_Pr-Cf_Pr
gen CP_rrrf_diff=Cr_Pr-Cr_Pf

gen CS_fffr_diff=Cf_Sf-Cf_Sr
gen CS_ffrf_diff=Cf_Sf-Cr_Sf
gen CS_rrfr_diff=Cr_Sr-Cf_Sr
gen CS_rrrf_diff=Cr_Sr-Cr_Sf

gen CR_fffr_diff=Cf_Rf-Cf_Rr
gen CR_ffrf_diff=Cf_Rf-Cr_Rf
gen CR_rrfr_diff=Cr_Rr-Cf_Rr
gen CR_rrrf_diff=Cr_Rr-Cr_Rf


gen HV_fffr_diff=Hf_Vf-Hf_Vr
gen HV_ffrf_diff=Hf_Vf-Hr_Vf
gen HV_rrfr_diff=Hr_Vr-Hf_Vr
gen HV_rrrf_diff=Hr_Vr-Hr_Vf

gen HP_fffr_diff=Hf_Pf-Hf_Pr
gen HP_ffrf_diff=Hf_Pf-Hr_Pf
gen HP_rrfr_diff=Hr_Pr-Hf_Pr
gen HP_rrrf_diff=Hr_Pr-Hr_Pf

gen HS_fffr_diff=Hf_Sf-Hf_Sr
gen HS_ffrf_diff=Hf_Sf-Hr_Sf
gen HS_rrfr_diff=Hr_Sr-Hf_Sr
gen HS_rrrf_diff=Hr_Sr-Hr_Sf

gen HR_fffr_diff=Hf_Rf-Hf_Rr
gen HR_ffrf_diff=Hf_Rf-Hr_Rf
gen HR_rrfr_diff=Hr_Rr-Hf_Rr
gen HR_rrrf_diff=Hr_Rr-Hr_Rf


gen VP_fffr_diff=Vf_Pf-Vf_Pr
gen VP_ffrf_diff=Vf_Pf-Vr_Pf
gen VP_rrfr_diff=Vr_Pr-Vf_Pr
gen VP_rrrf_diff=Vr_Pr-Vr_Pf

gen VS_fffr_diff=Vf_Sf-Vf_Sr
gen VS_ffrf_diff=Vf_Sf-Vr_Sf
gen VS_rrfr_diff=Vr_Sr-Vf_Sr
gen VS_rrrf_diff=Vr_Sr-Vr_Sf

gen VR_fffr_diff=Vf_Rf-Vf_Rr
gen VR_ffrf_diff=Vf_Rf-Vr_Rf
gen VR_rrfr_diff=Vr_Rr-Vf_Rr
gen VR_rrrf_diff=Vr_Rr-Vr_Rf


gen PS_fffr_diff=Pf_Sf-Pf_Sr
gen PS_ffrf_diff=Pf_Sf-Pr_Sf
gen PS_rrfr_diff=Pr_Sr-Pf_Sr
gen PS_rrrf_diff=Pr_Sr-Pr_Sf

gen PR_fffr_diff=Pf_Rf-Pf_Rr
gen PR_ffrf_diff=Pf_Rf-Pr_Rf
gen PR_rrfr_diff=Pr_Rr-Pf_Rr
gen PR_rrrf_diff=Pr_Rr-Pr_Rf


gen SR_fffr_diff=Sf_Rf-Sf_Rr
gen SR_ffrf_diff=Sf_Rf-Sr_Rf
gen SR_rrfr_diff=Sr_Rr-Sf_Rr
gen SR_rrrf_diff=Sr_Rr-Sr_Rf


*store sum stats of differences

gen cor1=.
gen cor2=.
gen cor1se=.
gen cor2se=.
gen cor1var=""
gen cor2var=""

gen diff=.
gen se=.

sum Cf_Hf
replace cor1=r(mean) in 1
replace cor1se=r(sd) in 1
sum Cf_Hr
replace cor2=r(mean) in 1
replace cor2se=r(mean) in 1

replace cor1var="Cf_Hf" in 1
replace cor2var="Cf_Hr" in 1

sum CH_fffr_diff
replace diff=r(mean) in 1
replace se=r(sd) in 1

sum Cf_Hf
replace cor1=r(mean) in 2
replace cor1se=r(sd) in 2
sum Cr_Hf
replace cor2=r(mean) in 2
replace cor2se=r(mean) in 2

replace cor1var="Cf_Hf" in 2
replace cor2var="Cr_Hf" in 2

sum CH_ffrf_diff
replace diff=r(mean) in 2
replace se=r(sd) in 2

sum Cr_Hr
replace cor1=r(mean) in 3
replace cor1se=r(sd) in 3
sum Cf_Hr
replace cor2=r(mean) in 3
replace cor2se=r(mean) in 3

replace cor1var="Cr_Hr" in 3
replace cor2var="Cf_Hr" in 3

sum CH_rrfr_diff
replace diff=r(mean) in 3
replace se=r(sd) in 3

sum Cr_Hr
replace cor1=r(mean) in 4
replace cor1se=r(sd) in 4
sum Cr_Hf
replace cor2=r(mean) in 4
replace cor2se=r(mean) in 4

replace cor1var="Cr_Hr" in 4
replace cor2var="Cr_Hf" in 4

sum CH_rrrf_diff
replace diff=r(mean) in 4
replace se=r(sd) in 4

sum Cf_Vf
replace cor1=r(mean) in 5
replace cor1se=r(sd) in 5
sum Cf_Vr
replace cor2=r(mean) in 5
replace cor2se=r(mean) in 5

replace cor1var="Cf_Vf" in 5
replace cor2var="Cf_Vr" in 5

sum CV_fffr_diff
replace diff=r(mean) in 5
replace se=r(sd) in 5

sum Cf_Vf
replace cor1=r(mean) in 6
replace cor1se=r(sd) in 6
sum Cr_Vf
replace cor2=r(mean) in 6
replace cor2se=r(mean) in 6

replace cor1var="Cf_Vf" in 6
replace cor2var="Cr_Vf" in 6

sum CV_ffrf_diff
replace diff=r(mean) in 6
replace se=r(sd) in 6

sum Cr_Vr
replace cor1=r(mean) in 7
replace cor1se=r(sd) in 7
sum Cf_Vr
replace cor2=r(mean) in 7
replace cor2se=r(mean) in 7

replace cor1var="Cr_Vr" in 7
replace cor2var="Cf_Vr" in 7

sum CV_rrfr_diff
replace diff=r(mean) in 7
replace se=r(sd) in 7

sum Cr_Vr
replace cor1=r(mean) in 8
replace cor1se=r(sd) in 8
sum Cr_Vf
replace cor2=r(mean) in 8
replace cor2se=r(mean) in 8

replace cor1var="Cr_Vr" in 8
replace cor2var="Cr_Vf" in 8

sum CV_rrrf_diff
replace diff=r(mean) in 8
replace se=r(sd) in 8

sum Cf_Pf
replace cor1=r(mean) in 9
replace cor1se=r(sd) in 9
sum Cf_Pr
replace cor2=r(mean) in 9
replace cor2se=r(mean) in 9

replace cor1var="Cf_Pf" in 9
replace cor2var="Cf_Pr" in 9

sum CP_fffr_diff
replace diff=r(mean) in 9
replace se=r(sd) in 9

sum Cf_Pf
replace cor1=r(mean) in 10
replace cor1se=r(sd) in 10
sum Cr_Pf
replace cor2=r(mean) in 10
replace cor2se=r(mean) in 10

replace cor1var="Cf_Pf" in 10
replace cor2var="Cr_Pf" in 10

sum CP_ffrf_diff
replace diff=r(mean) in 10
replace se=r(sd) in 10

sum Cr_Pr
replace cor1=r(mean) in 11
replace cor1se=r(sd) in 11
sum Cf_Pr
replace cor2=r(mean) in 11
replace cor2se=r(mean) in 11

replace cor1var="Cr_Pr" in 11
replace cor2var="Cf_Pr" in 11

sum CP_rrfr_diff
replace diff=r(mean) in 11
replace se=r(sd) in 11

sum Cr_Pr
replace cor1=r(mean) in 12
replace cor1se=r(sd) in 12
sum Cr_Pf
replace cor2=r(mean) in 12
replace cor2se=r(mean) in 12

replace cor1var="Cr_Pr" in 12
replace cor2var="Cr_Pf" in 12

sum CP_rrrf_diff
replace diff=r(mean) in 12
replace se=r(sd) in 12

sum Cf_Sf
replace cor1=r(mean) in 13
replace cor1se=r(sd) in 13
sum Cf_Sr
replace cor2=r(mean) in 13
replace cor2se=r(mean) in 13

replace cor1var="Cf_Sf" in 13
replace cor2var="Cf_Sr" in 13

sum CS_fffr_diff
replace diff=r(mean) in 13
replace se=r(sd) in 13

sum Cf_Sf
replace cor1=r(mean) in 14
replace cor1se=r(sd) in 14
sum Cr_Sf
replace cor2=r(mean) in 14
replace cor2se=r(mean) in 14

replace cor1var="Cf_Sf" in 14
replace cor2var="Cr_Sf" in 14

sum CS_ffrf_diff
replace diff=r(mean) in 14
replace se=r(sd) in 14

sum Cr_Sr
replace cor1=r(mean) in 15
replace cor1se=r(sd) in 15
sum Cf_Sr
replace cor2=r(mean) in 15
replace cor2se=r(mean) in 15

replace cor1var="Cr_Sr" in 15
replace cor2var="Cf_Sr" in 15

sum CS_rrfr_diff
replace diff=r(mean) in 15
replace se=r(sd) in 15

sum Cr_Sr
replace cor1=r(mean) in 16
replace cor1se=r(sd) in 16
sum Cr_Sf
replace cor2=r(mean) in 16
replace cor2se=r(mean) in 16

replace cor1var="Cr_Sr" in 16
replace cor2var="Cr_Sf" in 16

sum CS_rrrf_diff
replace diff=r(mean) in 16
replace se=r(sd) in 16

sum Cf_Rf
replace cor1=r(mean) in 17
replace cor1se=r(sd) in 17
sum Cf_Rr
replace cor2=r(mean) in 17
replace cor2se=r(mean) in 17

replace cor1var="Cf_Rf" in 17
replace cor2var="Cf_Rr" in 17

sum CR_fffr_diff
replace diff=r(mean) in 17
replace se=r(sd) in 17

sum Cf_Rf
replace cor1=r(mean) in 18
replace cor1se=r(sd) in 18
sum Cr_Rf
replace cor2=r(mean) in 18
replace cor2se=r(mean) in 18

replace cor1var="Cf_Rf" in 18
replace cor2var="Cr_Rf" in 18

sum CR_ffrf_diff
replace diff=r(mean) in 18
replace se=r(sd) in 18

sum Cr_Rr
replace cor1=r(mean) in 19
replace cor1se=r(sd) in 19
sum Cf_Rr
replace cor2=r(mean) in 19
replace cor2se=r(mean) in 19

replace cor1var="Cr_Rr" in 19
replace cor2var="Cf_Rr" in 19

sum CR_rrfr_diff
replace diff=r(mean) in 19
replace se=r(sd) in 19

sum Cr_Rr
replace cor1=r(mean) in 20
replace cor1se=r(sd) in 20
sum Cr_Rf
replace cor2=r(mean) in 20
replace cor2se=r(mean) in 20

replace cor1var="Cr_Rr" in 20
replace cor2var="Cr_Rf" in 20

sum CR_rrrf_diff
replace diff=r(mean) in 20
replace se=r(sd) in 20

sum Hf_Vf
replace cor1=r(mean) in 21
replace cor1se=r(sd) in 21
sum Hf_Vr
replace cor2=r(mean) in 21
replace cor2se=r(mean) in 21

replace cor1var="Hf_Vf" in 21
replace cor2var="Hf_Vr" in 21

sum HV_fffr_diff
replace diff=r(mean) in 21
replace se=r(sd) in 21

sum Hf_Vf
replace cor1=r(mean) in 22
replace cor1se=r(sd) in 22
sum Hr_Vf
replace cor2=r(mean) in 22
replace cor2se=r(mean) in 22

replace cor1var="Hf_Vf" in 22
replace cor2var="Hr_Vf" in 22

sum HV_ffrf_diff
replace diff=r(mean) in 22
replace se=r(sd) in 22

sum Hr_Vr
replace cor1=r(mean) in 23
replace cor1se=r(sd) in 23
sum Hf_Vr
replace cor2=r(mean) in 23
replace cor2se=r(mean) in 23

replace cor1var="Hr_Vr" in 23
replace cor2var="Hf_Vr" in 23

sum HV_rrfr_diff
replace diff=r(mean) in 23
replace se=r(sd) in 23

sum Hr_Vr
replace cor1=r(mean) in 24
replace cor1se=r(sd) in 24
sum Hr_Vf
replace cor2=r(mean) in 24
replace cor2se=r(mean) in 24

replace cor1var="Hr_Vr" in 24
replace cor2var="Hr_Vf" in 24

sum HV_rrrf_diff
replace diff=r(mean) in 24
replace se=r(sd) in 24

sum Hf_Pf
replace cor1=r(mean) in 25
replace cor1se=r(sd) in 25
sum Hf_Pr
replace cor2=r(mean) in 25
replace cor2se=r(mean) in 25

replace cor1var="Hf_Pf" in 25
replace cor2var="Hf_Pr" in 25

sum HP_fffr_diff
replace diff=r(mean) in 25
replace se=r(sd) in 25

sum Hf_Pf
replace cor1=r(mean) in 26
replace cor1se=r(sd) in 26
sum Hr_Pf
replace cor2=r(mean) in 26
replace cor2se=r(mean) in 26

replace cor1var="Hf_Pf" in 26
replace cor2var="Hr_Pf" in 26

sum HP_ffrf_diff
replace diff=r(mean) in 26
replace se=r(sd) in 26

sum Hr_Pr
replace cor1=r(mean) in 27
replace cor1se=r(sd) in 27
sum Hf_Pr
replace cor2=r(mean) in 27
replace cor2se=r(mean) in 27

replace cor1var="Hr_Pr" in 27
replace cor2var="Hf_Pr" in 27

sum HP_rrfr_diff
replace diff=r(mean) in 27
replace se=r(sd) in 27

sum Hr_Pr
replace cor1=r(mean) in 28
replace cor1se=r(sd) in 28
sum Hr_Pf
replace cor2=r(mean) in 28
replace cor2se=r(mean) in 28

replace cor1var="Hr_Pr" in 28
replace cor2var="Hr_Pf" in 28

sum HP_rrrf_diff
replace diff=r(mean) in 28
replace se=r(sd) in 28

sum Hf_Sf
replace cor1=r(mean) in 29
replace cor1se=r(sd) in 29
sum Hf_Sr
replace cor2=r(mean) in 29
replace cor2se=r(mean) in 29

replace cor1var="Hf_Sf" in 29
replace cor2var="Hf_Sr" in 29

sum HS_fffr_diff
replace diff=r(mean) in 29
replace se=r(sd) in 29

sum Hf_Sf
replace cor1=r(mean) in 30
replace cor1se=r(sd) in 30
sum Hr_Sf
replace cor2=r(mean) in 30
replace cor2se=r(mean) in 30

replace cor1var="Hf_Sf" in 30
replace cor2var="Hr_Sf" in 30

sum HS_ffrf_diff
replace diff=r(mean) in 30
replace se=r(sd) in 30

sum Hr_Sr
replace cor1=r(mean) in 31
replace cor1se=r(sd) in 31
sum Hf_Sr
replace cor2=r(mean) in 31
replace cor2se=r(mean) in 31

replace cor1var="Hr_Sr" in 31
replace cor2var="Hf_Sr" in 31

sum HS_rrfr_diff
replace diff=r(mean) in 31
replace se=r(sd) in 31

sum Hr_Sr
replace cor1=r(mean) in 32
replace cor1se=r(sd) in 32
sum Hr_Sf
replace cor2=r(mean) in 32
replace cor2se=r(mean) in 32

replace cor1var="Hr_Sr" in 32
replace cor2var="Hr_Sf" in 32

sum HS_rrrf_diff
replace diff=r(mean) in 32
replace se=r(sd) in 32

sum Hf_Rf
replace cor1=r(mean) in 33
replace cor1se=r(sd) in 33
sum Hf_Rr
replace cor2=r(mean) in 33
replace cor2se=r(mean) in 33

replace cor1var="Hf_Rf" in 33
replace cor2var="Hf_Rr" in 33

sum HR_fffr_diff
replace diff=r(mean) in 33
replace se=r(sd) in 33

sum Hf_Rf
replace cor1=r(mean) in 34
replace cor1se=r(sd) in 34
sum Hr_Rf
replace cor2=r(mean) in 34
replace cor2se=r(mean) in 34

replace cor1var="Hf_Rf" in 34
replace cor2var="Hr_Rf" in 34

sum HR_ffrf_diff
replace diff=r(mean) in 34
replace se=r(sd) in 34

sum Hr_Rr
replace cor1=r(mean) in 35
replace cor1se=r(sd) in 35
sum Hf_Rr
replace cor2=r(mean) in 35
replace cor2se=r(mean) in 35

replace cor1var="Hr_Rr" in 35
replace cor2var="Hf_Rr" in 35

sum HR_rrfr_diff
replace diff=r(mean) in 35
replace se=r(sd) in 35

sum Hr_Rr
replace cor1=r(mean) in 36
replace cor1se=r(sd) in 36
sum Hr_Rf
replace cor2=r(mean) in 36
replace cor2se=r(mean) in 36

replace cor1var="Hr_Rr" in 36
replace cor2var="Hr_Rf" in 36

sum HR_rrrf_diff
replace diff=r(mean) in 36
replace se=r(sd) in 36

sum Vf_Pf
replace cor1=r(mean) in 37
replace cor1se=r(sd) in 37
sum Vf_Pr
replace cor2=r(mean) in 37
replace cor2se=r(mean) in 37

replace cor1var="Vf_Pf" in 37
replace cor2var="Vf_Pr" in 37

sum VP_fffr_diff
replace diff=r(mean) in 37
replace se=r(sd) in 37

sum Vf_Pf
replace cor1=r(mean) in 38
replace cor1se=r(sd) in 38
sum Vr_Pf
replace cor2=r(mean) in 38
replace cor2se=r(mean) in 38

replace cor1var="Vf_Pf" in 38
replace cor2var="Vr_Pf" in 38

sum VP_ffrf_diff
replace diff=r(mean) in 38
replace se=r(sd) in 38

sum Vr_Pr
replace cor1=r(mean) in 39
replace cor1se=r(sd) in 39
sum Vf_Pr
replace cor2=r(mean) in 39
replace cor2se=r(mean) in 39

replace cor1var="Vr_Pr" in 39
replace cor2var="Vf_Pr" in 39

sum VP_rrfr_diff
replace diff=r(mean) in 39
replace se=r(sd) in 39

sum Vr_Pr
replace cor1=r(mean) in 40
replace cor1se=r(sd) in 40
sum Vr_Pf
replace cor2=r(mean) in 40
replace cor2se=r(mean) in 40

replace cor1var="Vr_Pr" in 40
replace cor2var="Vr_Pf" in 40

sum VP_rrrf_diff
replace diff=r(mean) in 40
replace se=r(sd) in 40

sum Vf_Sf
replace cor1=r(mean) in 41
replace cor1se=r(sd) in 41
sum Vf_Sr
replace cor2=r(mean) in 41
replace cor2se=r(mean) in 41

replace cor1var="Vf_Sf" in 41
replace cor2var="Vf_Sr" in 41

sum VS_fffr_diff
replace diff=r(mean) in 41
replace se=r(sd) in 41

sum Vf_Sf
replace cor1=r(mean) in 42
replace cor1se=r(sd) in 42
sum Vr_Sf
replace cor2=r(mean) in 42
replace cor2se=r(mean) in 42

replace cor1var="Vf_Sf" in 42
replace cor2var="Vr_Sf" in 42

sum VS_ffrf_diff
replace diff=r(mean) in 42
replace se=r(sd) in 42

sum Vr_Sr
replace cor1=r(mean) in 43
replace cor1se=r(sd) in 43
sum Vf_Sr
replace cor2=r(mean) in 43
replace cor2se=r(mean) in 43

replace cor1var="Vr_Sr" in 43
replace cor2var="Vf_Sr" in 43

sum VS_rrfr_diff
replace diff=r(mean) in 43
replace se=r(sd) in 43

sum Vr_Sr
replace cor1=r(mean) in 44
replace cor1se=r(sd) in 44
sum Vr_Sf
replace cor2=r(mean) in 44
replace cor2se=r(mean) in 44

replace cor1var="Vr_Sr" in 44
replace cor2var="Vr_Sf" in 44

sum VS_rrrf_diff
replace diff=r(mean) in 44
replace se=r(sd) in 44

sum Vf_Rf
replace cor1=r(mean) in 45
replace cor1se=r(sd) in 45
sum Vf_Rr
replace cor2=r(mean) in 45
replace cor2se=r(mean) in 45

replace cor1var="Vf_Rf" in 45
replace cor2var="Vf_Rr" in 45

sum VR_fffr_diff
replace diff=r(mean) in 45
replace se=r(sd) in 45

sum Vf_Rf
replace cor1=r(mean) in 46
replace cor1se=r(sd) in 46
sum Vr_Rf
replace cor2=r(mean) in 46
replace cor2se=r(mean) in 46

replace cor1var="Vf_Rf" in 46
replace cor2var="Vr_Rf" in 46

sum VR_ffrf_diff
replace diff=r(mean) in 46
replace se=r(sd) in 46

sum Vr_Rr
replace cor1=r(mean) in 47
replace cor1se=r(sd) in 47
sum Vf_Rr
replace cor2=r(mean) in 47
replace cor2se=r(mean) in 47

replace cor1var="Vr_Rr" in 47
replace cor2var="Vf_Rr" in 47

sum VR_rrfr_diff
replace diff=r(mean) in 47
replace se=r(sd) in 47

sum Vr_Rr
replace cor1=r(mean) in 48
replace cor1se=r(sd) in 48
sum Vr_Rf
replace cor2=r(mean) in 48
replace cor2se=r(mean) in 48

replace cor1var="Vr_Rr" in 48
replace cor2var="Vr_Rf" in 48

sum VR_rrrf_diff
replace diff=r(mean) in 48
replace se=r(sd) in 48

sum Pf_Sf
replace cor1=r(mean) in 49
replace cor1se=r(sd) in 49
sum Pf_Sr
replace cor2=r(mean) in 49
replace cor2se=r(mean) in 49

replace cor1var="Pf_Sf" in 49
replace cor2var="Pf_Sr" in 49

sum PS_fffr_diff
replace diff=r(mean) in 49
replace se=r(sd) in 49

sum Pf_Sf
replace cor1=r(mean) in 50
replace cor1se=r(sd) in 50
sum Pr_Sf
replace cor2=r(mean) in 50
replace cor2se=r(mean) in 50

replace cor1var="Pf_Sf" in 50
replace cor2var="Pr_Sf" in 50

sum PS_ffrf_diff
replace diff=r(mean) in 50
replace se=r(sd) in 50

sum Pr_Sr
replace cor1=r(mean) in 51
replace cor1se=r(sd) in 51
sum Pf_Sr
replace cor2=r(mean) in 51
replace cor2se=r(mean) in 51

replace cor1var="Pr_Sr" in 51
replace cor2var="Pf_Sr" in 51

sum PS_rrfr_diff
replace diff=r(mean) in 51
replace se=r(sd) in 51

sum Pr_Sr
replace cor1=r(mean) in 52
replace cor1se=r(sd) in 52
sum Pr_Sf
replace cor2=r(mean) in 52
replace cor2se=r(mean) in 52

replace cor1var="Pr_Sr" in 52
replace cor2var="Pr_Sf" in 52

sum PS_rrrf_diff
replace diff=r(mean) in 52
replace se=r(sd) in 52

sum Pf_Rf
replace cor1=r(mean) in 53
replace cor1se=r(sd) in 53
sum Pf_Rr
replace cor2=r(mean) in 53
replace cor2se=r(mean) in 53

replace cor1var="Pf_Rf" in 53
replace cor2var="Pf_Rr" in 53

sum PR_fffr_diff
replace diff=r(mean) in 53
replace se=r(sd) in 53

sum Pf_Rf
replace cor1=r(mean) in 54
replace cor1se=r(sd) in 54
sum Pr_Rf
replace cor2=r(mean) in 54
replace cor2se=r(mean) in 54

replace cor1var="Pf_Rf" in 54
replace cor2var="Pr_Rf" in 54

sum PR_ffrf_diff
replace diff=r(mean) in 54
replace se=r(sd) in 54

sum Pr_Rr
replace cor1=r(mean) in 55
replace cor1se=r(sd) in 55
sum Pf_Rr
replace cor2=r(mean) in 55
replace cor2se=r(mean) in 55

replace cor1var="Pr_Rr" in 55
replace cor2var="Pf_Rr" in 55

sum PR_rrfr_diff
replace diff=r(mean) in 55
replace se=r(sd) in 55

sum Pr_Rr
replace cor1=r(mean) in 56
replace cor1se=r(sd) in 56
sum Pr_Rf
replace cor2=r(mean) in 56
replace cor2se=r(mean) in 56

replace cor1var="Pr_Rr" in 56
replace cor2var="Pr_Rf" in 56

sum PR_rrrf_diff
replace diff=r(mean) in 56
replace se=r(sd) in 56

sum Sf_Rf
replace cor1=r(mean) in 57
replace cor1se=r(sd) in 57
sum Sf_Rr
replace cor2=r(mean) in 57
replace cor2se=r(mean) in 57

replace cor1var="Sf_Rf" in 57
replace cor2var="Sf_Rr" in 57

sum SR_fffr_diff
replace diff=r(mean) in 57
replace se=r(sd) in 57

sum Sf_Rf
replace cor1=r(mean) in 58
replace cor1se=r(sd) in 58
sum Sr_Rf
replace cor2=r(mean) in 58
replace cor2se=r(mean) in 58

replace cor1var="Sf_Rf" in 58
replace cor2var="Sr_Rf" in 58

sum SR_ffrf_diff
replace diff=r(mean) in 58
replace se=r(sd) in 58

sum Sr_Rr
replace cor1=r(mean) in 59
replace cor1se=r(sd) in 59
sum Sf_Rr
replace cor2=r(mean) in 59
replace cor2se=r(mean) in 59

replace cor1var="Sr_Rr" in 59
replace cor2var="Sf_Rr" in 59

sum SR_rrfr_diff
replace diff=r(mean) in 59
replace se=r(sd) in 59

sum Sr_Rr
replace cor1=r(mean) in 60
replace cor1se=r(sd) in 60
sum Sr_Rf
replace cor2=r(mean) in 60
replace cor2se=r(mean) in 60

replace cor1var="Sr_Rr" in 60
replace cor2var="Sr_Rf" in 60

sum SR_rrrf_diff
replace diff=r(mean) in 60
replace se=r(sd) in 60



gen var_consp=0
replace var_consp=1 if _n<21
gen var_chaos=0
replace var_chaos=1 if (_n<5 | (_n>20 & _n<37))
gen var_viol=0
replace var_viol=1 if (_n>4 & _n<9) | (_n>20 & _n<25) | (_n>36 & _n<49)
gen var_pop=0
replace var_pop=1 if (_n>8 & _n<13) | (_n>24 & _n<29) | (_n>36 & _n<41) | (_n>48 & _n<57)
gen var_hs=0
replace var_hs=1 if (_n>12 & _n<17) | (_n>28 & _n<33) | (_n>40 & _n<45) | (_n>48 & _n<53) | (_n>56 & _n<61)
gen var_rr=0
replace var_rr=1 if (_n>16 & _n<21) | (_n>32 & _n<37) | (_n>44 & _n<49) | (_n>52 & _n<57) | (_n>56 & _n<61)
recode var_* (0=.) if _n>60


gen lo = diff-1.96*se
gen hi = diff+1.96*se


keep diff se lo hi cor1 cor2 cor1se cor2se var_* cor1var cor2var 
drop if _n>60

save "study3_cors_attentive.dta", replace